import { getImageCaptcha,sendMailCaptcha } from '@/services/common'

import { message } from 'antd';


const Model = {
    namespace: 'common',
    state: {
      currentUser: {},
      imageCaptchaApplyId:'',
    },
    effects: {
      *getImageCaptchaApplyId({payload}, { call, put }){
        const response = yield call(getImageCaptcha);
        yield put({
          type: 'setImageCaptchaApplyId',
          payload: response.data,
        });
      },
      *sendMailCaptcha({payload}, { call, put }){
        const response = yield call(sendMailCaptcha,payload);
        if (response.success){
            message.success("发送成功")
            return response.data
        }
      },
    },
    reducers: {
      setImageCaptchaApplyId(state, action) {
        return { ...state, imageCaptchaApplyId: action.payload || {} };
      },
    },
  };
  export default Model;